home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / layout / nsICSSParser.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  6KB  |  152 lines

  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4.  *
  5.  * The contents of this file are subject to the Mozilla Public License Version
  6.  * 1.1 (the "License"); you may not use this file except in compliance with
  7.  * the License. You may obtain a copy of the License at
  8.  * http://www.mozilla.org/MPL/
  9.  *
  10.  * Software distributed under the License is distributed on an "AS IS" basis,
  11.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12.  * for the specific language governing rights and limitations under the
  13.  * License.
  14.  *
  15.  * The Original Code is mozilla.org code.
  16.  *
  17.  * The Initial Developer of the Original Code is
  18.  * Netscape Communications Corporation.
  19.  * Portions created by the Initial Developer are Copyright (C) 1998
  20.  * the Initial Developer. All Rights Reserved.
  21.  *
  22.  * Contributor(s):
  23.  *
  24.  * Alternatively, the contents of this file may be used under the terms of
  25.  * either of the GNU General Public License Version 2 or later (the "GPL"),
  26.  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27.  * in which case the provisions of the GPL or the LGPL are applicable instead
  28.  * of those above. If you wish to allow use of your version of this file only
  29.  * under the terms of either the GPL or the LGPL, and not to allow others to
  30.  * use your version of this file under the terms of the MPL, indicate your
  31.  * decision by deleting the provisions above and replace them with the notice
  32.  * and other provisions required by the GPL or the LGPL. If you do not delete
  33.  * the provisions above, a recipient may use your version of this file under
  34.  * the terms of any one of the MPL, the GPL or the LGPL.
  35.  *
  36.  * ***** END LICENSE BLOCK ***** */
  37. #ifndef nsCSS1Parser_h___
  38. #define nsCSS1Parser_h___
  39.  
  40. #include "nsISupports.h"
  41. #include "nsAString.h"
  42. #include "nsCSSProperty.h"
  43. #include "nsColor.h"
  44.  
  45. class nsICSSStyleRule;
  46. class nsICSSStyleSheet;
  47. class nsIUnicharInputStream;
  48. class nsIURI;
  49. class nsCSSDeclaration;
  50. class nsICSSLoader;
  51. class nsICSSRule;
  52. class nsISupportsArray;
  53. class nsMediaList;
  54.  
  55. #define NS_ICSS_PARSER_IID    \
  56. { 0x94d1d921, 0xd6f6, 0x435f, \
  57.   {0xa5, 0xe8, 0x85, 0x3f, 0x6e, 0x34, 0x57, 0xf6} }
  58.  
  59. // Rule processing function
  60. typedef void (*PR_CALLBACK RuleAppendFunc) (nsICSSRule* aRule, void* aData);
  61.  
  62. // Interface to the css parser.
  63. class nsICSSParser : public nsISupports {
  64. public:
  65.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICSS_PARSER_IID)
  66.  
  67.   // Set a style sheet for the parser to fill in. The style sheet must
  68.   // implement the nsICSSStyleSheet interface
  69.   NS_IMETHOD SetStyleSheet(nsICSSStyleSheet* aSheet) = 0;
  70.  
  71.   // Set whether or not tags & classes are case sensitive or uppercased
  72.   NS_IMETHOD SetCaseSensitive(PRBool aCaseSensitive) = 0;
  73.  
  74.   // Set whether or not to emulate Nav quirks
  75.   NS_IMETHOD SetQuirkMode(PRBool aQuirkMode) = 0;
  76.  
  77. #ifdef  MOZ_SVG
  78.   // Set whether or not we are in an SVG element
  79.   NS_IMETHOD SetSVGMode(PRBool aSVGMode) = 0;
  80. #endif
  81.  
  82.   // Set loader to use for child sheets
  83.   NS_IMETHOD SetChildLoader(nsICSSLoader* aChildLoader) = 0;
  84.  
  85.   NS_IMETHOD Parse(nsIUnicharInputStream* aInput,
  86.                    nsIURI*                aSheetURL,
  87.                    nsIURI*                aBaseURI,
  88.                    PRUint32               aLineNumber,
  89.                    nsICSSStyleSheet*&     aResult) = 0;
  90.  
  91.   // Parse HTML style attribute or its equivalent in other markup
  92.   // languages.  aBaseURL is the base url to use for relative links in
  93.   // the declaration.
  94.   NS_IMETHOD ParseStyleAttribute(const nsAString&         aAttributeValue,
  95.                                  nsIURI*                  aDocURL,
  96.                                  nsIURI*                  aBaseURL,
  97.                                  nsICSSStyleRule**        aResult) = 0;
  98.  
  99.   NS_IMETHOD ParseAndAppendDeclaration(const nsAString&         aBuffer,
  100.                                        nsIURI*                  aSheetURL,
  101.                                        nsIURI*                  aBaseURL,
  102.                                        nsCSSDeclaration*        aDeclaration,
  103.                                        PRBool                   aParseOnlyOneDecl,
  104.                                        PRBool*                  aChanged,
  105.                                        PRBool                   aClearOldDecl) = 0;
  106.  
  107.   NS_IMETHOD ParseRule(const nsAString&   aRule,
  108.                        nsIURI*            aSheetURL,
  109.                        nsIURI*            aBaseURL,
  110.                        nsISupportsArray** aResult) = 0;
  111.  
  112.   NS_IMETHOD ParseProperty(const nsCSSProperty aPropID,
  113.                            const nsAString& aPropValue,
  114.                            nsIURI* aSheetURL,
  115.                            nsIURI* aBaseURL,
  116.                            nsCSSDeclaration* aDeclaration,
  117.                            PRBool* aChanged) = 0;
  118.  
  119.   /**
  120.    * Parse aBuffer into a media list |aMediaList|, which must be
  121.    * non-null, replacing its current contents.  If aHTMLMode is true,
  122.    * parse according to HTML rules, with commas as the most important
  123.    * delimiter.  Otherwise, parse according to CSS rules, with
  124.    * parentheses and strings more important than commas.
  125.    */
  126.   NS_IMETHOD ParseMediaList(const nsSubstring& aBuffer,
  127.                             nsIURI* aURL, // for error reporting
  128.                             PRUint32 aLineNumber, // for error reporting
  129.                             nsMediaList* aMediaList,
  130.                             PRBool aHTMLMode) = 0;
  131.  
  132.   /**
  133.    * Parse aBuffer into a nscolor |aColor|.  If aHandleAlphaColors is
  134.    * set, handle rgba()/hsla(). Will return NS_ERROR_FAILURE if
  135.    * aBuffer is not a valid CSS color specification.
  136.    *
  137.    * Will also currently return NS_ERROR_FAILURE if it is not
  138.    * self-contained (i.e.  doesn't reference any external style state,
  139.    * such as "initial" or "inherit").
  140.    */
  141.   NS_IMETHOD ParseColorString(const nsSubstring& aBuffer,
  142.                               nsIURI* aURL, // for error reporting
  143.                               PRUint32 aLineNumber, // for error reporting
  144.                               PRBool aHandleAlphaColors,
  145.                               nscolor* aColor) = 0;
  146. };
  147.  
  148. nsresult
  149. NS_NewCSSParser(nsICSSParser** aInstancePtrResult);
  150.  
  151. #endif /* nsCSS1Parser_h___ */
  152.